// 购买
const state = {
  pay_order: sessionStorage.getItem('pay_order')
    ? JSON.parse(sessionStorage.getItem('pay_order'))
    : {}
}

const Mutation = {
  SET_ORDER_DATA: 'SET_ORDER_DATA',
  SET_ORDER_DEFAULT: 'SET_ORDER_DEFAULT'
}

const mutations = {
  [Mutation.SET_ORDER_DATA](state, data) {
    state.pay_order = data
    sessionStorage.setItem('pay_order', JSON.stringify(data))
  },
  [Mutation.SET_ORDER_DEFAULT](state) {
    state.pay_order = {}
    sessionStorage.removeItem('pay_order')
  }
}

export default {
  namespaced: true,
  state,
  mutations
}
